﻿using System;

namespace _190_reverse_bits
{
    class Program
    {
        static void Main (string[] args)
        {
            Console.WriteLine (new Solution().reverseBits((uint)43261596));
        }
    }

    public class Solution
    {
        public uint reverseBits (uint n)
        {
            uint ret = 0;
            int power = 31;
            while (n != 0)
            {
                ret += (n & 1) << power;
                n = n >> 1;
                power -= 1;
            }
            return ret;
        }
    }
}
